package se.combitech.combiorder.rest;

import java.io.Serializable;
import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import se.combitech.combiorder.model.Customer;
import se.combitech.combiorder.service.CustomerService;

/**
 * JAX-RS Example This class produces a RESTful service to read the contents of the members table.
 */
@Path("/customers")
@RequestScoped
public class CustomerResourceRESTService implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 5063658268906180486L;

    @Inject
    private CustomerService customerService;

    @GET
    @Produces("text/xml")
    public List<Customer> listAllCustomer() {
        return customerService.findAllCustomers();
    }

    @GET
    @Path("/{id:[0-9][0-9]*}")
    @Produces("text/xml")
    public Customer lookupCustomerById(@PathParam("id") long id) {
        return customerService.findCustomerByID(id);
    }
    
}
